import React,{Component} from 'react';
import {FlatList,Text} from 'react-native'

export default class Demo07Component extends Component{
  constructor(){
    super();
    this.state = {
      myList:[
        {key:0,num:100},
        {key:1,num:200},
        {key:2,num:300}
      ]
    };
  }
  //info是一个形参，数据类型是一个对象，
  //该对象包含两个属性:item、index
  showListItem(info){
     return <Text>{info.item.num}</Text>
  }

  render(){
    return <FlatList 
    data={this.state.myList} 
    renderItem={this.showListItem}
    ></FlatList>
  }
}